// required adapters we provide factories for
Flair.require('Flair/Db/Async.js');
Flair.require('Flair/Db/Sync.js');

Flair.Db = {
	factory: function (dbFileName, adapter) {
		var connection = new air.SQLConnection();
		var dbFile = air.File.applicationDirectory.resolvePath(dbFileName);
		connection.open(dbFile);
		
		var db;
		switch(adapter) {
			case 'Async':
				db = new Flair.Db.Async(connection);
			case 'Sync':
			default: 
				db = new Flair.Db.Sync(connection);
		}
		
		db.setConnection(connection);
		return db;
	}
};